比ASP.NET Chart控制項更好的選擇 - Gooogle Charts with JavaScript
YouTube影片 -- https://youtu.be/lXkmN4tl_ew
範例如下(基本架構):
各位可以發現:
<div id="chart_div"></div>
2016/11月補充說明,
第一列的 script似乎已經更換(請注意原廠網站的範例,但我使用本文的 "舊" 寫法仍可運作)
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
原本的範例(程式碼)
<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      // Load the Visualization API and the piechart package.
      google.load('visualization', '1.0', {'packages':['corechart']});
      // Set a callback to run when the Google Visualization API is loaded.
      google.setOnLoadCallback(drawChart);
      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart() {
        // Create the data table.  ***原始資料***
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Topping');
        data.addColumn('number', 'Slices');
        data.addRows([
          ['Mushrooms', 3],
          ['Onions', 1],
          ['Olives', 1],
          ['Zucchini', 1],
          ['Pepperoni', 2]
        ]);
        // ************差異之處****************
        // Set chart options
        var options = {'title':'How Much Pizza I Ate Last Night',
                       'width':400,
                       'height':300};
        // Instantiate and draw our chart, passing in some options.
        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <!--Div that will hold the pie chart-->
    <div id="chart_div"></div>
  </body>
</html>
下一篇文章 -- http://ithelp.ithome.com.tw/articles/10188238
我們要把產生圖表的「真實數據」,從資料庫裡面取得